/**
 * 数据类型判断
 * @param o {Array|Object|String|Function|Number|Boolean|Undefined|Null|HTML} o-待处理的对象 param {String} type-类型字符串
 * @param type
 * @returns {*}
 */
export let isType = (o, type) => {
  if (!type) {
    return Object.prototype.toString.call(o)
  }
  switch (type.toLowerCase()) {
    case 'string':
      return Object.prototype.toString.call(o) === '[object String]'
    case 'number':
      return Object.prototype.toString.call(o) === '[object Number]'
    case 'boolean':
      return Object.prototype.toString.call(o) === '[object Boolean]'
    case 'undefined':
      return Object.prototype.toString.call(o) === '[object Undefined]'
    case 'null':
      return Object.prototype.toString.call(o) === '[object Null]'
    case 'function':
      return Object.prototype.toString.call(o) === '[object Function]'
    case 'array':
      return Object.prototype.toString.call(o) === '[object Array]'
    case 'object':
      return Object.prototype.toString.call(o) === '[object Object]'
    case 'nan':
      return isNaN(o)
    case 'elements':
      return Object.prototype.toString.call(o).indexOf('HTML') !== -1
    default:
      return null
  }
}
